home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: fred@genesis.demon.co.uk (Lawrence Kirby)
- Newsgroups: comp.lang.c.moderated,comp.std.c
- Subject: Behaviour of mem functions when n=0 ?
- Date: 6 Mar 1996 18:28:45 -0600
- Organization: none
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4hlaju$4g0@solutions.solon.com>
- Reply-To: fred@genesis.demon.co.uk
- NNTP-Posting-Host: solutions.solon.com
- X-Mailer: Demon Internet Simple News v1.27
-
- In article <4hgc3d$97a@solutions.solon.com>
- larry.jones@sdrc.com "Larry Jones" writes:
-
- > In article <4hdqn5$8qn@solutions.solon.com>, fred@genesis.demon.co.uk
- > (Lawrence Kirby) writes about memcmp et al. with n==0:
- > > Probably. However the result is defined by some rather unfortunate wording in
- > > the standard:
- >
- > The intent of the standard has been clarified by a Technical Corrigendum
- > which adds the following text to the introductory matter in 7.11.1
- > String Function Conventions:
- >
- > Where an argument declared as |size_t n| specifies the length of
- > the array for a function, |n| can have the value zero on a call
- > to that function. Unless explicitly stated otherwise in the
- > description of a particular function in this subclause, pointer
- > arguments on such a call must still have valid values, as
- > described in subclause 7.1.7. On such a call, a function that
- > locates a character finds no occurrence, a function that
- > compares two character sequences returns zero, and a function
- > that copies characters copies zero characters.
- >
- > Note that this applies to the strn* functions as well as the mem*
- > functions.
-
- That does pretty much clear it up. However the wording for the individual
- functions is still nonsensical and it would have been better if that had
- been fixed.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-